package com.pay.common.enums.lianlian;

import org.apache.commons.lang3.StringUtils;

/**
 * Created by Administrator on 2019/1/15.
 */
public enum AccountTypeEnum {
    //测试
    XINWANG_CS27("2018062100009027", "accpXW"),
    XINWANG_CS03("2018062800003003", "accpXW"),

    //生产
    //光大
    GUANGDA("", ""),
    //新网
    XINWANG("2018112801159539", "accpXW");

    public final String oidPartner;//企业商户号
    public final String accountType;//类型

    AccountTypeEnum(String oidPartner, String accountType) {
        this.oidPartner = oidPartner;
        this.accountType = accountType;
    }

    /**
     * 通过编码可以获取对应的名称
     *
     * @param key
     * @return
     */
    public static String getValueByKey(String key) {
        if (StringUtils.isBlank(key)) {
            return null;
        }
        String tName = null;
        for (AccountTypeEnum em : values()) {
            if (key.equals(em.oidPartner)) {
                tName = em.accountType;
                break;
            }
        }
        return tName;
    }
}
